﻿namespace ZetaHtmlEditControl.Helper
{
	using System.Collections.Generic;

	internal class MimeHelper
	{
		#region Public methods.
		// ------------------------------------------------------------------

		public static string MapFileExtensionToMimeType(
			string fileExtension)
		{
			checkFillMappingDictionary();

			fileExtension = fileExtension.Trim('.').ToLowerInvariant();

			if (_mappings.ContainsKey(fileExtension))
			{
				return _mappings[fileExtension];
			}
			else
			{
				return string.Format(
				   @"application/{0}",
				   fileExtension);
			}
		}

		// ------------------------------------------------------------------
		#endregion

		#region Private methods.
		// ------------------------------------------------------------------

		private static void checkFillMappingDictionary()
		{
			if (_mappings == null)
			{
				_mappings = new Dictionary<string, string>();

				// From Hannes Dorbarth from Imos (hd@imos.net).
				_mappings[@"pdf"] = @"application/pdf";
				_mappings[@"sig"] = @"application/pgp-signature";
				_mappings[@"spl"] = @"application/futuresplash";
				_mappings[@"class"] = @"application/octet-stream";
				_mappings[@"ps"] = @"application/postscript";
				_mappings[@"torrent"] = @"application/x-bittorrent";
				_mappings[@"dvi"] = @"application/x-dvi";
				_mappings[@"gz"] = @"application/x-gzip";
				_mappings[@"pac"] = @"application/x-ns-proxy-autoconfig";
				_mappings[@"swf"] = @"application/x-shockwave-flash";
				_mappings[@"tar.gz"] = @"application/x-tgz";
				_mappings[@"tgz"] = @"application/x-tgz";
				_mappings[@"tar"] = @"application/x-tar";
				_mappings[@"zip"] = @"application/zip";
				_mappings[@"mp3"] = @"audio/mpeg";
				_mappings[@"m3u"] = @"audio/x-mpegurl";
				_mappings[@"wma"] = @"audio/x-ms-wma";
				_mappings[@"wax"] = @"audio/x-ms-wax";
				_mappings[@"ogg"] = @"application/ogg";
				_mappings[@"wav"] = @"audio/x-wav";
				_mappings[@"gif"] = @"image/gif";
				//_mappings[@"jpg"] = @"image/jpeg";
				//_mappings[@"jpeg"] = @"image/jpeg";
				_mappings[@"png"] = @"image/png";
				_mappings[@"xbm"] = @"image/x-xbitmap";
				_mappings[@"xpm"] = @"image/x-xpixmap";
				_mappings[@"xwd"] = @"image/x-xwindowdump";
				_mappings[@"css"] = @"text/css";
				_mappings[@"html"] = @"text/html";
				_mappings[@"htm"] = @"text/html";
				_mappings[@"js"] = @"text/javascript";
				_mappings[@"asc"] = @"text/plain";
				_mappings[@"c"] = @"text/plain";
				_mappings[@"cpp"] = @"text/plain";
				_mappings[@"log"] = @"text/plain";
				_mappings[@"conf"] = @"text/plain";
				_mappings[@"text"] = @"text/plain";
				_mappings[@"txt"] = @"text/plain";
				_mappings[@"dtd"] = @"text/xml";
				_mappings[@"xml"] = @"text/xml";
				_mappings[@"mpeg"] = @"video/mpeg";
				_mappings[@"mpg"] = @"video/mpeg";
				_mappings[@"mov"] = @"video/quicktime";
				_mappings[@"qt"] = @"video/quicktime";
				_mappings[@"avi"] = @"video/x-msvideo";
				_mappings[@"asf"] = @"video/x-ms-asf";
				_mappings[@"asx"] = @"video/x-ms-asf";
				_mappings[@"wmv"] = @"video/x-ms-wmv";
				_mappings[@"bz2"] = @"application/x-bzip";
				_mappings[@"tbz"] = @"application/x-bzip-compressed-tar";
				_mappings[@"tar.bz2"] = @"application/x-bzip-compressed-tar";

				// From http://www.starttipp.de/verschiedenes/mime-types.html.
				_mappings[@"3dm"] = @"x-world/x-3dmf";
				_mappings[@"3dmf"] = @"x-world/x-3dmf";
				_mappings[@"a"] = @"application/octet-stream";
				_mappings[@"aab"] = @"application/x-authorware-bin";
				_mappings[@"aam"] = @"application/x-authorware-map";
				_mappings[@"aas"] = @"application/x-authorware-seg";
				_mappings[@"abc"] = @"text/vnd.abc";
				_mappings[@"acgi"] = @"text/html";
				_mappings[@"afl"] = @"video/animaflex";
				_mappings[@"ai"] = @"application/postscript";
				_mappings[@"aif"] = @"audio/aiff";
				_mappings[@"aif"] = @"audio/x-aiff";
				_mappings[@"aifc"] = @"audio/aiff";
				_mappings[@"aifc"] = @"audio/x-aiff";
				_mappings[@"aiff"] = @"audio/aiff";
				_mappings[@"aiff"] = @"audio/x-aiff";
				_mappings[@"aim"] = @"application/x-aim";
				_mappings[@"aip"] = @"text/x-audiosoft-intra";
				_mappings[@"ani"] = @"application/x-navi-animation";
				_mappings[@"aos"] = @"application/x-nokia-9000-communicator-add-on-software";
				_mappings[@"aps"] = @"application/mime";
				_mappings[@"arc"] = @"application/octet-stream";
				_mappings[@"arj"] = @"application/arj";
				_mappings[@"arj"] = @"application/octet-stream";
				_mappings[@"art"] = @"image/x-jg";
				_mappings[@"asf"] = @"video/x-ms-asf";
				_mappings[@"asm"] = @"text/x-asm";
				_mappings[@"asp"] = @"text/asp";
				_mappings[@"asx"] = @"application/x-mplayer2";
				_mappings[@"asx"] = @"video/x-ms-asf";
				_mappings[@"asx"] = @"video/x-ms-asf-plugin";
				_mappings[@"au"] = @"audio/basic";
				_mappings[@"au"] = @"audio/x-au";
				_mappings[@"avi"] = @"application/x-troff-msvideo";
				_mappings[@"avi"] = @"video/avi";
				_mappings[@"avi"] = @"video/msvideo";
				_mappings[@"avi"] = @"video/x-msvideo";
				_mappings[@"avs"] = @"video/avs-video";
				_mappings[@"bcpio"] = @"application/x-bcpio";
				_mappings[@"bin"] = @"application/mac-binary";
				_mappings[@"bin"] = @"application/macbinary";
				_mappings[@"bin"] = @"application/octet-stream";
				_mappings[@"bin"] = @"application/x-binary";
				_mappings[@"bin"] = @"application/x-macbinary";
				_mappings[@"bm"] = @"image/bmp";
				_mappings[@"bmp"] = @"image/bmp";
				_mappings[@"bmp"] = @"image/x-windows-bmp";
				_mappings[@"boo"] = @"application/book";
				_mappings[@"book"] = @"application/book";
				_mappings[@"boz"] = @"application/x-bzip2";
				_mappings[@"bsh"] = @"application/x-bsh";
				_mappings[@"bz"] = @"application/x-bzip";
				_mappings[@"bz2"] = @"application/x-bzip2";
				_mappings[@"c"] = @"text/plain";
				_mappings[@"c"] = @"text/x-c";
				_mappings[@"c++"] = @"text/plain";
				_mappings[@"cat"] = @"application/vnd.ms-pki.seccat";
				_mappings[@"cc"] = @"text/plain";
				_mappings[@"cc"] = @"text/x-c";
				_mappings[@"ccad"] = @"application/clariscad";
				_mappings[@"cco"] = @"application/x-cocoa";
				_mappings[@"cdf"] = @"application/cdf";
				_mappings[@"cdf"] = @"application/x-cdf";
				_mappings[@"cdf"] = @"application/x-netcdf";
				_mappings[@"cer"] = @"application/pkix-cert";
				_mappings[@"cer"] = @"application/x-x509-ca-cert";
				_mappings[@"cha"] = @"application/x-chat";
				_mappings[@"chat"] = @"application/x-chat";
				_mappings[@"class"] = @"application/java";
				_mappings[@"class"] = @"application/java-byte-code";
				_mappings[@"class"] = @"application/x-java-class";
				_mappings[@"com"] = @"application/octet-stream";
				_mappings[@"com"] = @"text/plain";
				_mappings[@"conf"] = @"text/plain";
				_mappings[@"cpio"] = @"application/x-cpio";
				_mappings[@"cpp"] = @"text/x-c";
				_mappings[@"cpt"] = @"application/mac-compactpro";
				_mappings[@"cpt"] = @"application/x-compactpro";
				_mappings[@"cpt"] = @"application/x-cpt";
				_mappings[@"crl"] = @"application/pkcs-crl";
				_mappings[@"crl"] = @"application/pkix-crl";
				_mappings[@"crt"] = @"application/pkix-cert";
				_mappings[@"crt"] = @"application/x-x509-ca-cert";
				_mappings[@"crt"] = @"application/x-x509-user-cert";
				_mappings[@"csh"] = @"application/x-csh";
				_mappings[@"csh"] = @"text/x-script.csh";
				_mappings[@"css"] = @"application/x-pointplus";
				_mappings[@"css"] = @"text/css";
				_mappings[@"cxx"] = @"text/plain";
				_mappings[@"dcr"] = @"application/x-director";
				_mappings[@"deepv"] = @"application/x-deepv";
				_mappings[@"def"] = @"text/plain";
				_mappings[@"der"] = @"application/x-x509-ca-cert";
				_mappings[@"dif"] = @"video/x-dv";
				_mappings[@"dir"] = @"application/x-director";
				_mappings[@"dl"] = @"video/dl";
				_mappings[@"dl"] = @"video/x-dl";
				_mappings[@"doc"] = @"application/msword";
				_mappings[@"dot"] = @"application/msword";
				_mappings[@"dp"] = @"application/commonground";
				_mappings[@"drw"] = @"application/drafting";
				_mappings[@"dump"] = @"application/octet-stream";
				_mappings[@"dv"] = @"video/x-dv";
				_mappings[@"dvi"] = @"application/x-dvi";
				_mappings[@"dwf"] = @"drawing/x-dwf (old)";
				_mappings[@"dwf"] = @"model/vnd.dwf";
				_mappings[@"dwg"] = @"application/acad";
				_mappings[@"dwg"] = @"image/vnd.dwg";
				_mappings[@"dwg"] = @"image/x-dwg";
				_mappings[@"dxf"] = @"application/dxf";
				_mappings[@"dxf"] = @"image/vnd.dwg";
				_mappings[@"dxf"] = @"image/x-dwg";
				_mappings[@"dxr"] = @"application/x-director";
				_mappings[@"el"] = @"text/x-script.elisp";
				_mappings[@"elc"] = @"application/x-bytecode.elisp (compiled elisp)";
				_mappings[@"elc"] = @"application/x-elc";
				_mappings[@"env"] = @"application/x-envoy";
				_mappings[@"eps"] = @"application/postscript";
				_mappings[@"es"] = @"application/x-esrehber";
				_mappings[@"etx"] = @"text/x-setext";
				_mappings[@"evy"] = @"application/envoy";
				_mappings[@"evy"] = @"application/x-envoy";
				_mappings[@"exe"] = @"application/octet-stream";
				_mappings[@"f"] = @"text/plain";
				_mappings[@"f"] = @"text/x-fortran";
				_mappings[@"f77"] = @"text/x-fortran";
				_mappings[@"f90"] = @"text/plain";
				_mappings[@"f90"] = @"text/x-fortran";
				_mappings[@"fdf"] = @"application/vnd.fdf";
				_mappings[@"fif"] = @"application/fractals";
				_mappings[@"fif"] = @"image/fif";
				_mappings[@"fli"] = @"video/fli";
				_mappings[@"fli"] = @"video/x-fli";
				_mappings[@"flo"] = @"image/florian";
				_mappings[@"flx"] = @"text/vnd.fmi.flexstor";
				_mappings[@"fmf"] = @"video/x-atomic3d-feature";
				_mappings[@"for"] = @"text/plain";
				_mappings[@"for"] = @"text/x-fortran";
				_mappings[@"fpx"] = @"image/vnd.fpx";
				_mappings[@"fpx"] = @"image/vnd.net-fpx";
				_mappings[@"frl"] = @"application/freeloader";
				_mappings[@"funk"] = @"audio/make";
				_mappings[@"g"] = @"text/plain";
				_mappings[@"g3"] = @"image/g3fax";
				_mappings[@"gif"] = @"image/gif";
				_mappings[@"gl"] = @"video/gl";
				_mappings[@"gl"] = @"video/x-gl";
				_mappings[@"gsd"] = @"audio/x-gsm";
				_mappings[@"gsm"] = @"audio/x-gsm";
				_mappings[@"gsp"] = @"application/x-gsp";
				_mappings[@"gss"] = @"application/x-gss";
				_mappings[@"gtar"] = @"application/x-gtar";
				_mappings[@"gz"] = @"application/x-compressed";
				_mappings[@"gz"] = @"application/x-gzip";
				_mappings[@"gzip"] = @"application/x-gzip";
				_mappings[@"gzip"] = @"multipart/x-gzip";
				_mappings[@"h"] = @"text/plain";
				_mappings[@"h"] = @"text/x-h";
				_mappings[@"hdf"] = @"application/x-hdf";
				_mappings[@"help"] = @"application/x-helpfile";
				_mappings[@"hgl"] = @"application/vnd.hp-hpgl";
				_mappings[@"hh"] = @"text/plain";
				_mappings[@"hh"] = @"text/x-h";
				_mappings[@"hlb"] = @"text/x-script";
				_mappings[@"hlp"] = @"application/hlp";
				_mappings[@"hlp"] = @"application/x-helpfile";
				_mappings[@"hlp"] = @"application/x-winhelp";
				_mappings[@"hpg"] = @"application/vnd.hp-hpgl";
				_mappings[@"hpgl"] = @"application/vnd.hp-hpgl";
				_mappings[@"hqx"] = @"application/binhex";
				_mappings[@"hqx"] = @"application/binhex4";
				_mappings[@"hqx"] = @"application/mac-binhex";
				_mappings[@"hqx"] = @"application/mac-binhex40";
				_mappings[@"hqx"] = @"application/x-binhex40";
				_mappings[@"hqx"] = @"application/x-mac-binhex40";
				_mappings[@"hta"] = @"application/hta";
				_mappings[@"htc"] = @"text/x-component";
				_mappings[@"htm"] = @"text/html";
				_mappings[@"html"] = @"text/html";
				_mappings[@"htmls"] = @"text/html";
				_mappings[@"htt"] = @"text/webviewhtml";
				_mappings[@"htx"] = @"text/html";
				_mappings[@"ice"] = @"x-conference/x-cooltalk";
				_mappings[@"ico"] = @"image/x-icon";
				_mappings[@"idc"] = @"text/plain";
				_mappings[@"ief"] = @"image/ief";
				_mappings[@"iefs"] = @"image/ief";
				_mappings[@"iges"] = @"application/iges";
				_mappings[@"iges"] = @"model/iges";
				_mappings[@"igs"] = @"application/iges";
				_mappings[@"igs"] = @"model/iges";
				_mappings[@"ima"] = @"application/x-ima";
				_mappings[@"imap"] = @"application/x-httpd-imap";
				_mappings[@"inf"] = @"application/inf";
				_mappings[@"ins"] = @"application/x-internett-signup";
				_mappings[@"ip"] = @"application/x-ip2";
				_mappings[@"isu"] = @"video/x-isvideo";
				_mappings[@"it"] = @"audio/it";
				_mappings[@"iv"] = @"application/x-inventor";
				_mappings[@"ivr"] = @"i-world/i-vrml";
				_mappings[@"ivy"] = @"application/x-livescreen";
				_mappings[@"jam"] = @"audio/x-jam";
				_mappings[@"jav"] = @"text/plain";
				_mappings[@"jav"] = @"text/x-java-source";
				_mappings[@"java"] = @"text/plain";
				_mappings[@"java"] = @"text/x-java-source";
				_mappings[@"jcm"] = @"application/x-java-commerce";
				_mappings[@"jfif"] = @"image/jpeg";
				_mappings[@"jfif"] = @"image/pjpeg";
				_mappings[@"jfif-tbnl"] = @"image/jpeg";
				_mappings[@"jpe"] = @"image/jpeg";
				//_mappings[@"jpe"] = @"image/pjpeg";
				_mappings[@"jpeg"] = @"image/jpeg";
				//_mappings[@"jpeg"] = @"image/pjpeg";
				_mappings[@"jpg"] = @"image/jpeg";
				//_mappings[@"jpg"] = @"image/pjpeg";
				_mappings[@"jps"] = @"image/x-jps";
				_mappings[@"js"] = @"application/x-javascript";
				_mappings[@"jut"] = @"image/jutvision";
				_mappings[@"kar"] = @"audio/midi";
				_mappings[@"kar"] = @"music/x-karaoke";
				_mappings[@"ksh"] = @"application/x-ksh";
				_mappings[@"ksh"] = @"text/x-script.ksh";
				_mappings[@"la"] = @"audio/nspaudio";
				_mappings[@"la"] = @"audio/x-nspaudio";
				_mappings[@"lam"] = @"audio/x-liveaudio";
				_mappings[@"latex"] = @"application/x-latex";
				_mappings[@"lha"] = @"application/lha";
				_mappings[@"lha"] = @"application/octet-stream";
				_mappings[@"lha"] = @"application/x-lha";
				_mappings[@"lhx"] = @"application/octet-stream";
				_mappings[@"list"] = @"text/plain";
				_mappings[@"lma"] = @"audio/nspaudio";
				_mappings[@"lma"] = @"audio/x-nspaudio";
				_mappings[@"log"] = @"text/plain";
				_mappings[@"lsp"] = @"application/x-lisp";
				_mappings[@"lsp"] = @"text/x-script.lisp";
				_mappings[@"lst"] = @"text/plain";
				_mappings[@"lsx"] = @"text/x-la-asf";
				_mappings[@"ltx"] = @"application/x-latex";
				_mappings[@"lzh"] = @"application/octet-stream";
				_mappings[@"lzh"] = @"application/x-lzh";
				_mappings[@"lzx"] = @"application/lzx";
				_mappings[@"lzx"] = @"application/octet-stream";
				_mappings[@"lzx"] = @"application/x-lzx";
				_mappings[@"m"] = @"text/plain";
				_mappings[@"m"] = @"text/x-m";
				_mappings[@"m1v"] = @"video/mpeg";
				_mappings[@"m2a"] = @"audio/mpeg";
				_mappings[@"m2v"] = @"video/mpeg";
				_mappings[@"m3u"] = @"audio/x-mpequrl";
				_mappings[@"man"] = @"application/x-troff-man";
				_mappings[@"map"] = @"application/x-navimap";
				_mappings[@"mar"] = @"text/plain";
				_mappings[@"mbd"] = @"application/mbedlet";
				_mappings[@"mc$"] = @"application/x-magic-cap-package-1.0";
				_mappings[@"mcd"] = @"application/mcad";
				_mappings[@"mcd"] = @"application/x-mathcad";
				_mappings[@"mcf"] = @"image/vasa";
				_mappings[@"mcf"] = @"text/mcf";
				_mappings[@"mcp"] = @"application/netmc";
				_mappings[@"me"] = @"application/x-troff-me";
				_mappings[@"mht"] = @"message/rfc822";
				_mappings[@"mhtml"] = @"message/rfc822";
				_mappings[@"mid"] = @"application/x-midi";
				_mappings[@"mid"] = @"audio/midi";
				_mappings[@"mid"] = @"audio/x-mid";
				_mappings[@"mid"] = @"audio/x-midi";
				_mappings[@"mid"] = @"music/crescendo";
				_mappings[@"mid"] = @"x-music/x-midi";
				_mappings[@"midi"] = @"application/x-midi";
				_mappings[@"midi"] = @"audio/midi";
				_mappings[@"midi"] = @"audio/x-mid";
				_mappings[@"midi"] = @"audio/x-midi";
				_mappings[@"midi"] = @"music/crescendo";
				_mappings[@"midi"] = @"x-music/x-midi";
				_mappings[@"mif"] = @"application/x-frame";
				_mappings[@"mif"] = @"application/x-mif";
				_mappings[@"mime"] = @"message/rfc822";
				_mappings[@"mime"] = @"www/mime";
				_mappings[@"mjf"] = @"audio/x-vnd.audioexplosion.mjuicemediafile";
				_mappings[@"mjpg"] = @"video/x-motion-jpeg";
				_mappings[@"mm"] = @"application/base64";
				_mappings[@"mm"] = @"application/x-meme";
				_mappings[@"mme"] = @"application/base64";
				_mappings[@"mod"] = @"audio/mod";
				_mappings[@"mod"] = @"audio/x-mod";
				_mappings[@"moov"] = @"video/quicktime";
				_mappings[@"mov"] = @"video/quicktime";
				_mappings[@"movie"] = @"video/x-sgi-movie";
				_mappings[@"mp2"] = @"audio/mpeg";
				_mappings[@"mp2"] = @"audio/x-mpeg";
				_mappings[@"mp2"] = @"video/mpeg";
				_mappings[@"mp2"] = @"video/x-mpeg";
				_mappings[@"mp2"] = @"video/x-mpeq2a";
				_mappings[@"mp3"] = @"audio/mpeg3";
				_mappings[@"mp3"] = @"audio/x-mpeg-3";
				_mappings[@"mp3"] = @"video/mpeg";
				_mappings[@"mp3"] = @"video/x-mpeg";
				_mappings[@"mpa"] = @"audio/mpeg";
				_mappings[@"mpa"] = @"video/mpeg";
				_mappings[@"mpc"] = @"application/x-project";
				_mappings[@"mpe"] = @"video/mpeg";
				_mappings[@"mpeg"] = @"video/mpeg";
				_mappings[@"mpg"] = @"audio/mpeg";
				_mappings[@"mpg"] = @"video/mpeg";
				_mappings[@"mpga"] = @"audio/mpeg";
				_mappings[@"mpp"] = @"application/vnd.ms-project";
				_mappings[@"mpt"] = @"application/x-project";
				_mappings[@"mpv"] = @"application/x-project";
				_mappings[@"mpx"] = @"application/x-project";
				_mappings[@"mrc"] = @"application/marc";
				_mappings[@"ms"] = @"application/x-troff-ms";
				_mappings[@"mv"] = @"video/x-sgi-movie";
				_mappings[@"my"] = @"audio/make";
				_mappings[@"mzz"] = @"application/x-vnd.audioexplosion.mzz";
				_mappings[@"nap"] = @"image/naplps";
				_mappings[@"naplps"] = @"image/naplps";
				_mappings[@"nc"] = @"application/x-netcdf";
				_mappings[@"ncm"] = @"application/vnd.nokia.configuration-message";
				_mappings[@"nif"] = @"image/x-niff";
				_mappings[@"niff"] = @"image/x-niff";
				_mappings[@"nix"] = @"application/x-mix-transfer";
				_mappings[@"nsc"] = @"application/x-conference";
				_mappings[@"nvd"] = @"application/x-navidoc";
				_mappings[@"o"] = @"application/octet-stream";
				_mappings[@"oda"] = @"application/oda";
				_mappings[@"omc"] = @"application/x-omc";
				_mappings[@"omcd"] = @"application/x-omcdatamaker";
				_mappings[@"omcr"] = @"application/x-omcregerator";
				_mappings[@"p"] = @"text/x-pascal";
				_mappings[@"p10"] = @"application/pkcs10";
				_mappings[@"p10"] = @"application/x-pkcs10";
				_mappings[@"p12"] = @"application/pkcs-12";
				_mappings[@"p12"] = @"application/x-pkcs12";
				_mappings[@"p7a"] = @"application/x-pkcs7-signature";
				_mappings[@"p7c"] = @"application/pkcs7-mime";
				_mappings[@"p7c"] = @"application/x-pkcs7-mime";
				_mappings[@"p7m"] = @"application/pkcs7-mime";
				_mappings[@"p7m"] = @"application/x-pkcs7-mime";
				_mappings[@"p7r"] = @"application/x-pkcs7-certreqresp";
				_mappings[@"p7s"] = @"application/pkcs7-signature";
				_mappings[@"part"] = @"application/pro_eng";
				_mappings[@"pas"] = @"text/pascal";
				_mappings[@"pbm"] = @"image/x-portable-bitmap";
				_mappings[@"pcl"] = @"application/vnd.hp-pcl";
				_mappings[@"pcl"] = @"application/x-pcl";
				_mappings[@"pct"] = @"image/x-pict";
				_mappings[@"pcx"] = @"image/x-pcx";
				_mappings[@"pdb"] = @"chemical/x-pdb";
				_mappings[@"pdf"] = @"application/pdf";
				_mappings[@"pfunk"] = @"audio/make";
				_mappings[@"pfunk"] = @"audio/make.my.funk";
				_mappings[@"pgm"] = @"image/x-portable-graymap";
				_mappings[@"pgm"] = @"image/x-portable-greymap";
				_mappings[@"pic"] = @"image/pict";
				_mappings[@"pict"] = @"image/pict";
				_mappings[@"pkg"] = @"application/x-newton-compatible-pkg";
				_mappings[@"pko"] = @"application/vnd.ms-pki.pko";
				_mappings[@"pl"] = @"text/plain";
				_mappings[@"pl"] = @"text/x-script.perl";
				_mappings[@"plx"] = @"application/x-pixclscript";
				_mappings[@"pm"] = @"image/x-xpixmap";
				_mappings[@"pm"] = @"text/x-script.perl-module";
				_mappings[@"pm4"] = @"application/x-pagemaker";
				_mappings[@"pm5"] = @"application/x-pagemaker";
				_mappings[@"png"] = @"image/png";
				_mappings[@"pnm"] = @"application/x-portable-anymap";
				_mappings[@"pnm"] = @"image/x-portable-anymap";
				_mappings[@"pot"] = @"application/mspowerpoint";
				_mappings[@"pot"] = @"application/vnd.ms-powerpoint";
				_mappings[@"pov"] = @"model/x-pov";
				_mappings[@"ppa"] = @"application/vnd.ms-powerpoint";
				_mappings[@"ppm"] = @"image/x-portable-pixmap";
				_mappings[@"pps"] = @"application/mspowerpoint";
				_mappings[@"pps"] = @"application/vnd.ms-powerpoint";
				_mappings[@"ppt"] = @"application/mspowerpoint";
				_mappings[@"ppt"] = @"application/powerpoint";
				_mappings[@"ppt"] = @"application/vnd.ms-powerpoint";
				_mappings[@"ppt"] = @"application/x-mspowerpoint";
				_mappings[@"ppz"] = @"application/mspowerpoint";
				_mappings[@"pre"] = @"application/x-freelance";
				_mappings[@"prt"] = @"application/pro_eng";
				_mappings[@"ps"] = @"application/postscript";
				_mappings[@"psd"] = @"application/octet-stream";
				_mappings[@"pvu"] = @"paleovu/x-pv";
				_mappings[@"pwz"] = @"application/vnd.ms-powerpoint";
				_mappings[@"py"] = @"text/x-script.phyton";
				_mappings[@"pyc"] = @"applicaiton/x-bytecode.python";
				_mappings[@"qcp"] = @"audio/vnd.qcelp";
				_mappings[@"qd3"] = @"x-world/x-3dmf";
				_mappings[@"qd3d"] = @"x-world/x-3dmf";
				_mappings[@"qif"] = @"image/x-quicktime";
				_mappings[@"qt"] = @"video/quicktime";
				_mappings[@"qtc"] = @"video/x-qtc";
				_mappings[@"qti"] = @"image/x-quicktime";
				_mappings[@"qtif"] = @"image/x-quicktime";
				_mappings[@"ra"] = @"audio/x-pn-realaudio";
				_mappings[@"ra"] = @"audio/x-pn-realaudio-plugin";
				_mappings[@"ra"] = @"audio/x-realaudio";
				_mappings[@"ram"] = @"audio/x-pn-realaudio";
				_mappings[@"ras"] = @"application/x-cmu-raster";
				_mappings[@"ras"] = @"image/cmu-raster";
				_mappings[@"ras"] = @"image/x-cmu-raster";
				_mappings[@"rast"] = @"image/cmu-raster";
				_mappings[@"rexx"] = @"text/x-script.rexx";
				_mappings[@"rf"] = @"image/vnd.rn-realflash";
				_mappings[@"rgb"] = @"image/x-rgb";
				_mappings[@"rm"] = @"application/vnd.rn-realmedia";
				_mappings[@"rm"] = @"audio/x-pn-realaudio";
				_mappings[@"rmi"] = @"audio/mid";
				_mappings[@"rmm"] = @"audio/x-pn-realaudio";
				_mappings[@"rmp"] = @"audio/x-pn-realaudio";
				_mappings[@"rmp"] = @"audio/x-pn-realaudio-plugin";
				_mappings[@"rng"] = @"application/ringing-tones";
				_mappings[@"rng"] = @"application/vnd.nokia.ringing-tone";
				_mappings[@"rnx"] = @"application/vnd.rn-realplayer";
				_mappings[@"roff"] = @"application/x-troff";
				_mappings[@"rp"] = @"image/vnd.rn-realpix";
				_mappings[@"rpm"] = @"audio/x-pn-realaudio-plugin";
				_mappings[@"rt"] = @"text/richtext";
				_mappings[@"rt"] = @"text/vnd.rn-realtext";
				_mappings[@"rtf"] = @"application/rtf";
				_mappings[@"rtf"] = @"application/x-rtf";
				_mappings[@"rtf"] = @"text/richtext";
				_mappings[@"rtx"] = @"application/rtf";
				_mappings[@"rtx"] = @"text/richtext";
				_mappings[@"rv"] = @"video/vnd.rn-realvideo";
				_mappings[@"s"] = @"text/x-asm";
				_mappings[@"s3m"] = @"audio/s3m";
				_mappings[@"saveme"] = @"application/octet-stream";
				_mappings[@"sbk"] = @"application/x-tbook";
				_mappings[@"scm"] = @"application/x-lotusscreencam";
				_mappings[@"scm"] = @"text/x-script.guile";
				_mappings[@"scm"] = @"text/x-script.scheme";
				_mappings[@"scm"] = @"video/x-scm";
				_mappings[@"sdml"] = @"text/plain";
				_mappings[@"sdp"] = @"application/sdp";
				_mappings[@"sdp"] = @"application/x-sdp";
				_mappings[@"sdr"] = @"application/sounder";
				_mappings[@"sea"] = @"application/sea";
				_mappings[@"sea"] = @"application/x-sea";
				_mappings[@"set"] = @"application/set";
				_mappings[@"sgm"] = @"text/sgml";
				_mappings[@"sgm"] = @"text/x-sgml";
				_mappings[@"sgml"] = @"text/sgml";
				_mappings[@"sgml"] = @"text/x-sgml";
				_mappings[@"sh"] = @"application/x-bsh";
				_mappings[@"sh"] = @"application/x-sh";
				_mappings[@"sh"] = @"application/x-shar";
				_mappings[@"sh"] = @"text/x-script.sh";
				_mappings[@"shar"] = @"application/x-bsh";
				_mappings[@"shar"] = @"application/x-shar";
				_mappings[@"shtml"] = @"text/html";
				_mappings[@"shtml"] = @"text/x-server-parsed-html";
				_mappings[@"sid"] = @"audio/x-psid";
				_mappings[@"sit"] = @"application/x-sit";
				_mappings[@"sit"] = @"application/x-stuffit";
				_mappings[@"skd"] = @"application/x-koan";
				_mappings[@"skm"] = @"application/x-koan";
				_mappings[@"skp"] = @"application/x-koan";
				_mappings[@"skt"] = @"application/x-koan";
				_mappings[@"sl"] = @"application/x-seelogo";
				_mappings[@"smi"] = @"application/smil";
				_mappings[@"smil"] = @"application/smil";
				_mappings[@"snd"] = @"audio/basic";
				_mappings[@"snd"] = @"audio/x-adpcm";
				_mappings[@"sol"] = @"application/solids";
				_mappings[@"spc"] = @"application/x-pkcs7-certificates";
				_mappings[@"spc"] = @"text/x-speech";
				_mappings[@"spl"] = @"application/futuresplash";
				_mappings[@"spr"] = @"application/x-sprite";
				_mappings[@"sprite"] = @"application/x-sprite";
				_mappings[@"src"] = @"application/x-wais-source";
				_mappings[@"ssi"] = @"text/x-server-parsed-html";
				_mappings[@"ssm"] = @"application/streamingmedia";
				_mappings[@"sst"] = @"application/vnd.ms-pki.certstore";
				_mappings[@"step"] = @"application/step";
				_mappings[@"stl"] = @"application/sla";
				_mappings[@"stl"] = @"application/vnd.ms-pki.stl";
				_mappings[@"stl"] = @"application/x-navistyle";
				_mappings[@"stp"] = @"application/step";
				_mappings[@"sv4cpio"] = @"application/x-sv4cpio";
				_mappings[@"sv4crc"] = @"application/x-sv4crc";
				_mappings[@"svf"] = @"image/vnd.dwg";
				_mappings[@"svf"] = @"image/x-dwg";
				_mappings[@"svr"] = @"application/x-world";
				_mappings[@"svr"] = @"x-world/x-svr";
				_mappings[@"swf"] = @"application/x-shockwave-flash";
				_mappings[@"t"] = @"application/x-troff";
				_mappings[@"talk"] = @"text/x-speech";
				_mappings[@"tar"] = @"application/x-tar";
				_mappings[@"tbk"] = @"application/toolbook";
				_mappings[@"tbk"] = @"application/x-tbook";
				_mappings[@"tcl"] = @"application/x-tcl";
				_mappings[@"tcl"] = @"text/x-script.tcl";
				_mappings[@"tcsh"] = @"text/x-script.tcsh";
				_mappings[@"tex"] = @"application/x-tex";
				_mappings[@"texi"] = @"application/x-texinfo";
				_mappings[@"texinfo"] = @"application/x-texinfo";
				_mappings[@"text"] = @"application/plain";
				_mappings[@"text"] = @"text/plain";
				_mappings[@"tgz"] = @"application/gnutar";
				_mappings[@"tgz"] = @"application/x-compressed";
				_mappings[@"tif"] = @"image/tiff";
				_mappings[@"tif"] = @"image/x-tiff";
				_mappings[@"tiff"] = @"image/tiff";
				_mappings[@"tiff"] = @"image/x-tiff";
				_mappings[@"tr"] = @"application/x-troff";
				_mappings[@"tsi"] = @"audio/tsp-audio";
				_mappings[@"tsp"] = @"application/dsptype";
				_mappings[@"tsp"] = @"audio/tsplayer";
				_mappings[@"tsv"] = @"text/tab-separated-values";
				_mappings[@"turbot"] = @"image/florian";
				_mappings[@"txt"] = @"text/plain";
				_mappings[@"uil"] = @"text/x-uil";
				_mappings[@"uni"] = @"text/uri-list";
				_mappings[@"unis"] = @"text/uri-list";
				_mappings[@"unv"] = @"application/i-deas";
				_mappings[@"uri"] = @"text/uri-list";
				_mappings[@"uris"] = @"text/uri-list";
				_mappings[@"ustar"] = @"application/x-ustar";
				_mappings[@"ustar"] = @"multipart/x-ustar";
				_mappings[@"uu"] = @"application/octet-stream";
				_mappings[@"uu"] = @"text/x-uuencode";
				_mappings[@"uue"] = @"text/x-uuencode";
				_mappings[@"vcd"] = @"application/x-cdlink";
				_mappings[@"vcs"] = @"text/x-vcalendar";
				_mappings[@"vda"] = @"application/vda";
				_mappings[@"vdo"] = @"video/vdo";
				_mappings[@"vew"] = @"application/groupwise";
				_mappings[@"viv"] = @"video/vivo";
				_mappings[@"viv"] = @"video/vnd.vivo";
				_mappings[@"vivo"] = @"video/vivo";
				_mappings[@"vivo"] = @"video/vnd.vivo";
				_mappings[@"vmd"] = @"application/vocaltec-media-desc";
				_mappings[@"vmf"] = @"application/vocaltec-media-file";
				_mappings[@"voc"] = @"audio/voc";
				_mappings[@"voc"] = @"audio/x-voc";
				_mappings[@"vos"] = @"video/vosaic";
				_mappings[@"vox"] = @"audio/voxware";
				_mappings[@"vqe"] = @"audio/x-twinvq-plugin";
				_mappings[@"vqf"] = @"audio/x-twinvq";
				_mappings[@"vql"] = @"audio/x-twinvq-plugin";
				_mappings[@"vrml"] = @"application/x-vrml";
				_mappings[@"vrml"] = @"model/vrml";
				_mappings[@"vrml"] = @"x-world/x-vrml";
				_mappings[@"vrt"] = @"x-world/x-vrt";
				_mappings[@"vsd"] = @"application/x-visio";
				_mappings[@"vst"] = @"application/x-visio";
				_mappings[@"vsw"] = @"application/x-visio";
				_mappings[@"w60"] = @"application/wordperfect6.0";
				_mappings[@"w61"] = @"application/wordperfect6.1";
				_mappings[@"w6w"] = @"application/msword";
				_mappings[@"wav"] = @"audio/wav";
				_mappings[@"wav"] = @"audio/x-wav";
				_mappings[@"wb1"] = @"application/x-qpro";
				_mappings[@"wbmp"] = @"image/vnd.wap.wbmp";
				_mappings[@"web"] = @"application/vnd.xara";
				_mappings[@"wiz"] = @"application/msword";
				_mappings[@"wk1"] = @"application/x-123";
				_mappings[@"wmf"] = @"windows/metafile";
				_mappings[@"wml"] = @"text/vnd.wap.wml";
				_mappings[@"wmlc"] = @"application/vnd.wap.wmlc";
				_mappings[@"wmls"] = @"text/vnd.wap.wmlscript";
				_mappings[@"wmlsc"] = @"application/vnd.wap.wmlscriptc";
				_mappings[@"word"] = @"application/msword";
				_mappings[@"wp"] = @"application/wordperfect";
				_mappings[@"wp5"] = @"application/wordperfect";
				_mappings[@"wp5"] = @"application/wordperfect6.0";
				_mappings[@"wp6"] = @"application/wordperfect";
				_mappings[@"wpd"] = @"application/wordperfect";
				_mappings[@"wpd"] = @"application/x-wpwin";
				_mappings[@"wq1"] = @"application/x-lotus";
				_mappings[@"wri"] = @"application/mswrite";
				_mappings[@"wri"] = @"application/x-wri";
				_mappings[@"wrl"] = @"application/x-world";
				_mappings[@"wrl"] = @"model/vrml";
				_mappings[@"wrl"] = @"x-world/x-vrml";
				_mappings[@"wrz"] = @"model/vrml";
				_mappings[@"wrz"] = @"x-world/x-vrml";
				_mappings[@"wsc"] = @"text/scriplet";
				_mappings[@"wsrc"] = @"application/x-wais-source";
				_mappings[@"wtk"] = @"application/x-wintalk";
				_mappings[@"xbm"] = @"image/x-xbitmap";
				_mappings[@"xbm"] = @"image/x-xbm";
				_mappings[@"xbm"] = @"image/xbm";
				_mappings[@"xdr"] = @"video/x-amt-demorun";
				_mappings[@"xgz"] = @"xgl/drawing";
				_mappings[@"xif"] = @"image/vnd.xiff";
				_mappings[@"xl"] = @"application/excel";
				_mappings[@"xla"] = @"application/excel";
				_mappings[@"xla"] = @"application/x-excel";
				_mappings[@"xla"] = @"application/x-msexcel";
				_mappings[@"xlb"] = @"application/excel";
				_mappings[@"xlb"] = @"application/vnd.ms-excel";
				_mappings[@"xlb"] = @"application/x-excel";
				_mappings[@"xlc"] = @"application/excel";
				_mappings[@"xlc"] = @"application/vnd.ms-excel";
				_mappings[@"xlc"] = @"application/x-excel";
				_mappings[@"xld"] = @"application/excel";
				_mappings[@"xld"] = @"application/x-excel";
				_mappings[@"xlk"] = @"application/excel";
				_mappings[@"xlk"] = @"application/x-excel";
				_mappings[@"xll"] = @"application/excel";
				_mappings[@"xll"] = @"application/vnd.ms-excel";
				_mappings[@"xll"] = @"application/x-excel";
				_mappings[@"xlm"] = @"application/excel";
				_mappings[@"xlm"] = @"application/vnd.ms-excel";
				_mappings[@"xlm"] = @"application/x-excel";
				_mappings[@"xls"] = @"application/excel";
				_mappings[@"xls"] = @"application/vnd.ms-excel";
				_mappings[@"xls"] = @"application/x-excel";
				_mappings[@"xls"] = @"application/x-msexcel";
				_mappings[@"xlt"] = @"application/excel";
				_mappings[@"xlt"] = @"application/x-excel";
				_mappings[@"xlv"] = @"application/excel";
				_mappings[@"xlv"] = @"application/x-excel";
				_mappings[@"xlw"] = @"application/excel";
				_mappings[@"xlw"] = @"application/vnd.ms-excel";
				_mappings[@"xlw"] = @"application/x-excel";
				_mappings[@"xlw"] = @"application/x-msexcel";
				_mappings[@"xm"] = @"audio/xm";
				_mappings[@"xml"] = @"application/xml";
				_mappings[@"xml"] = @"text/xml";
				_mappings[@"xmz"] = @"xgl/movie";
				_mappings[@"xpix"] = @"application/x-vnd.ls-xpix";
				_mappings[@"xpm"] = @"image/x-xpixmap";
				_mappings[@"xpm"] = @"image/xpm";
				_mappings[@"x-png"] = @"image/png";
				_mappings[@"xsr"] = @"video/x-amt-showrun";
				_mappings[@"xwd"] = @"image/x-xwd";
				_mappings[@"xwd"] = @"image/x-xwindowdump";
				_mappings[@"xyz"] = @"chemical/x-pdb";
				_mappings[@"z"] = @"application/x-compress";
				_mappings[@"z"] = @"application/x-compressed";
				_mappings[@"zip"] = @"application/x-compressed";
				_mappings[@"zip"] = @"application/x-zip-compressed";
				_mappings[@"zip"] = @"application/zip";
				_mappings[@"zoo"] = @"application/octet-stream";
				_mappings[@"zsh"] = @"text/x-script.zsh";
			}
		}

		// ------------------------------------------------------------------
		#endregion

		#region Private variables.
		// ------------------------------------------------------------------

		private static Dictionary<string, string> _mappings;

		// ------------------------------------------------------------------
		#endregion
	}
}